<?xml version="1.0"?>
<files>
<file filename="Order_%Y%.xml">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl">
<xsl:output method="xml"/>
<xsl:template match="/">

<ordercollection>
<xsl:for-each select="orders/order">
  <order>
<id>
<primary_id><xsl:value-of select="increment_id"/></primary_id>
</id>
  <billing>
  <total><xsl:value-of select="grand_total"/></total> 
  <address>
  <company><xsl:value-of select="billing/company"/></company> 
  <name_first><xsl:value-of select="billing/firstname"/></name_first> 
  <name_last><xsl:value-of select="billing/lastname"/></name_last> 
  <address1><xsl:value-of select="billing/street1"/></address1> 
  <address2><xsl:value-of select="billing/street2"/></address2>
  <city><xsl:value-of select="billing/city"/></city> 
  <zip><xsl:value-of select="billing/postcode"/></zip> 
  <state><xsl:value-of select="billing/region_code"/></state> 
  <country><xsl:value-of select="billing/country_id"/></country> 
  <phone><xsl:value-of select="billing/telephone"/></phone> 
  </address>
  </billing>
  <time>
  <order_time><xsl:value-of select="created_at_timestamp"/></order_time> 
  </time>
  <ship_data>
  <ship_via><xsl:value-of select="shipping_method"/></ship_via> 
  <ship_type><xsl:value-of select="shipping_description"/></ship_type> 
  <address>
  <company><xsl:value-of select="shipping/company"/></company> 
  <name_first><xsl:value-of select="shipping/firstname"/></name_first> 
  <name_last><xsl:value-of select="shipping/lastname"/></name_last> 
  <address1><xsl:value-of select="shipping/street1"/></address1> 
  <address2><xsl:value-of select="shipping/street2"/></address2>
  <city><xsl:value-of select="shipping/city"/></city> 
  <zip><xsl:value-of select="shipping/postcode"/></zip> 
  <state><xsl:value-of select="shipping/region_code"/></state> 
  <country><xsl:value-of select="shipping/country_id"/></country> 
  <phone><xsl:value-of select="shipping/telephone"/></phone> 
  </address>
  <box>
      <xsl:for-each select="items/item">
      <item>
  <code><xsl:value-of select="sku"/></code> 
  <quantity><xsl:value-of select="round(qty_ordered)"/></quantity> 
    </item>
      </xsl:for-each>
  </box>
  </ship_data>

  </order>
</xsl:for-each>
</ordercollection>

</xsl:template>
</xsl:stylesheet>
</file>
</files>